<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>追加费用</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<style>
.error{
	color:red;
}
</style>
<body class="iframeBody">
	<div class="Wrapper">
		<div id="pageInTab" class="pageInTab">
			<form id="addition_charges_form" class="l-form">
				<div class="fieldset1 tabel_col tabel_col_s clearFix">
					<div class="caption">
						<span class="title">追加费用明细</span>
					</div>
				</div>
				<div class="fieldset1 tabel_col tabel_col_s clearFix">
					<div class="fieldBox col_100">
							<div id="gradeDateId" class="sq-grid"></div>
					</div>
				</div>
			</form>
		</div>
		<!--  -->
		<div class="fieldBox col_100" style="display:none;">
	        	<input id="assSchFeeMId" type="text" class="ui-textbox" value="${id}">
	    </div>
	</div>
	<script type="text/javascript">
		var id = '${id}';
	    // 验证值小数位数不能超过指定位数param 
	    $.validator.addMethod("decimallen", function(value, element, param) {
	        var decimallen =eval("/^-?\\d+(\\.\\d{0," + param + "})?$/"); 
	        return this.optional(element) || (decimallen.test(value));
		}, "小数位数不能超过{0}位");
	    
		$(function () {
			initChargesData();
        	$("#addition_charges_form").ligerForm({
        		validate:true
            });
		});
		
	    function initChargesData()
	    { 
			griddata = $("#gradeDateId").ligerGrid({
			    	url: '<%=path%>/ass/assSchFee/initAssSchFeeDList.do',
			    	method : 'get',
			    	parms:{"id":id},
	                columns: [
	                	{ display: '编号', name: 'id',width: 150 },
		                { display: '费用项',  name: 'feeTypeCd',width: 150, 
								render: function (item)
			                    {
			                        if (parseInt(item.feeTypeCd) == 1) return '过户提档费';
			                        if (parseInt(item.feeTypeCd) == 2) return '停车费';
			                        if (parseInt(item.feeTypeCd) == 3) return '其他费用';
			                        if (parseInt(item.feeTypeCd) == 4) return '拖车费';
			                        if (parseInt(item.feeTypeCd) == 5) return '运费';
			                        if (parseInt(item.feeTypeCd) == 6) return '整备费';
			                    }
		                },
		                { display: '借款金额',  name: 'applyAmt',width: 150,type:'float'},
	               	    { display: '开户行', name: 'payeeBankNm',width: 150,type: 'text' },
	               	    { display: '开户行行号', name: 'payeeBankNo',width: 150,type: 'text' },
	               		{ display: '收款账号', name: 'payeeAccNo',width: 150,type: 'text' },
	               		{ display: '收款户名', name: 'payeeAccNm',width: 150,type: 'text' },
	               		{ display: '用途备注', name: 'feeDesc',width: 150,type: 'text' },
	               		{ display: '查看附件', name: 'fileUploader',width: 150,isSort: false,isEllipsis: false, 
	               			render: function (rowdata, rowindex, value){
	               				var str =  '<a class="sq-button-hasicon" href="javascript:checkFileRes(';
	               					str += "'"+rowdata.id+"'";
	               					str += ')"><i class="sqBtnIco_3"></i>查看附件</a>';
	               				return str;
	               			}
	               		}
						],
		                
		                onSelectRow: function (rowdata, rowindex)
		                {
		                    $("#txtrowindex").val(rowindex);
		                },
		                pageSize:10,
		                enabledEdit: true, 
		                isScroll: false, 
		                width: '100%',
		    	        root:'rows',
		    	        record:'Total',
		    	        hideLoadButton : true,
		    	        width: '100%',
		    	        height:'100%',
		    	        heightDiff:-2,
		    	        checkbox:true,
		    	        rownumbers:true
		            }); 	   	
		}
    	//格式化时间
    	function renderDate(rowdata, index, value){
    		var dateStr = "";
    		if(null != value){
    			var date = new Date(value);
    			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
    		}
    		return dateStr;
    	}
		
		//查看附件
		function checkFileRes(id){
			//alert("附件id "+id );
			// 添加附件
	    	$.ligerDialog.open({title: '查看附件信息',height: 300,width: 700, url: '<%=path%>/ass/assSchFee/toCheckfilesPage.do?id='+id,
	     	   buttons: [
	             {
	                 text: "关闭", onclick: onCancel, type: 'cancel', cls: 'l-dialog-btn-no'
	             }
	         	]
	     	});
		}
		var onCancel = function (item, Dialog) {
				if (Dialog.onCancel) Dialog.onCancel();
		};
</script>
</body>
</html>